﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using UI.Application.Share.Reactor;

namespace UI.Application.Reactor.Converter
{
    public class ReactorStateToBackgroundConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var state = (ReactorState)value;
            var result = System.Windows.Media.Brushes.Transparent;
            if (value == null) return result;
            switch (state)
            {
                case ReactorState.None:
                    result = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(222, 243, 250));  
                    break;
                case ReactorState.Running:
                    result = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(241,237,216));
                    break;
                case ReactorState.Completed:
                    result = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(219, 241, 216));
                    break;
                case ReactorState.Cancel:
                    result = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(140, 68, 216));
                    break;
                default: return result;
            }
            return result;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
